<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    1-100之和为:<span id="result"></span>
    <script>
        var resultObj=document.getElementById("result")
        var sum=0
        var i=0
        do{
            sum+=i;
            i++;
        }while(i<=100)
        resultObj.innerText=sum;
    </script>
</body>
</html>